export function goBack($router) {
    $router.back()
}

/**
    *
 */
export function accMul(arg1,arg2) {
    let m=0,s1=arg1.toString(),s2=arg2.toString();
    try{m+=s1.split(".")[1].length}catch(e){}
    try{m+=s2.split(".")[1].length}catch(e){}
    return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
}



Object.defineProperty(Object.prototype, "copy", {
    writable: true,
    value: function () {
        return deepCopy(this)
    }
});
const deepCopy = (value) => {
    switch (Object.prototype.toString.call(value)) {
        case '[object Array]':
            return value.map(e => deepCopy(e));
        case '[object Date]':
            return new Date(value);
        case '[object Object]':
            // eslint-disable-next-line no-case-declarations
            const copied = {}
            for (const key in value) {
                // eslint-disable-next-line no-prototype-builtins
                if (value.hasOwnProperty(key)) {
                    copied[key] = deepCopy(value[key]);
                }
            }
            return copied
        default:
            return value;
    }
}
